﻿using QYmall.Core.Common.Emum;
using QYmall.Core.Common.Helper;
using QYmall.Core.Model.Models;
using QYmall.Core.Model.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace QYmall.Core.IServices
{
    /// <summary>
    /// 配送方式接口
    /// </summary>
    public interface IShopDeliveryService : IBaseService
    {
        /// <summary>
        /// 查询一条记录
        /// </summary>
        Task<ShopDelivery?> QueryAsync(Expression<Func<ShopDelivery, bool>> funcWhere, WriteRoRead writeAndRead = WriteRoRead.Read);

        /// <summary>
        /// 查询指定数量列表
        /// </summary>
        Task<IEnumerable<ShopDelivery>> QueryListAsync(int top, Expression<Func<ShopDelivery, bool>> funcWhere,
            string orderBy, WriteRoRead writeAndRead = WriteRoRead.Read);

        /// <summary>
        /// 查询分页列表
        /// </summary>
        Task<PaginationList<ShopDelivery>> QueryPageAsync(int pageSize, int pageIndex, Expression<Func<ShopDelivery, bool>> funcWhere,
            string orderBy, WriteRoRead writeAndRead = WriteRoRead.Read);

        /// <summary>
        /// 添加一条记录
        /// </summary>
        Task<ShopDeliveryDto> AddAsync(ShopDeliveryEditDto modelDto, WriteRoRead writeAndRead = WriteRoRead.Write);

        /// <summary>
        /// 修改一条记录
        /// </summary>
        Task<bool> UpdateAsync(long id, ShopDeliveryEditDto modelDto, WriteRoRead writeAndRead = WriteRoRead.Write);

        /// <summary>
        /// 根据条件删除记录
        /// </summary>
        Task<bool> DeleteAsync(Expression<Func<ShopDelivery, bool>> funcWhere, WriteRoRead writeAndRead = WriteRoRead.Write);

        /// <summary>
        /// 统计配送费用
        /// </summary>
        /// <param name="deliveryId">配送ID</param>
        /// <param name="province">省份名称</param>
        /// <param name="totalWeight">总重量(克)</param>
        /// <param name="isInsure">是否保价</param>
        /// <param name="insurePrice">保价金额</param>
        Task<ShopDeliveryTotalDto> QueryTotalAsync(int id, string? province, int totalWeight,
            byte isInsure, decimal insurePrice, WriteRoRead writeAndRead = WriteRoRead.Read);
    }
}
